/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DialogEditUser.java
 *
 * Created on Jun 11, 2012, 9:27:22 PM
 */
package com.ebdesk.view.masterdata;

import com.ebdesk.controller.masterdata.PrinterController;
import com.ebdesk.view.masterdata.*;
import com.ebdesk.view.masterdata.*;
import com.ebdesk.view.masterdata.*;
import com.ebdesk.controller.masterdata.UserController;
import com.ebdesk.controller.masterdata.Validator;
import com.ebdesk.model.masterdata.Printer;
import com.ebdesk.model.masterdata.User;
import java.awt.Color;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Acer
 */
public class DialogDetailPrinter extends javax.swing.JDialog {
    private Printer printer;
    
    private PrinterController printerController;
    /** Creates new form DialogEditUser */
    public DialogDetailPrinter(java.awt.Frame parent, boolean modal, Printer printer) {
        super(parent, modal);
        this.printer = printer;
        
        printerController = new PrinterController();
        
        this.setLocationRelativeTo(null);
        try {
                        // Set System L&F
                    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                } 
                catch (UnsupportedLookAndFeelException e) {
                   // handle exception
                }
                catch (ClassNotFoundException e) {
                   // handle exception
                }
                catch (InstantiationException e) {
                   // handle exception
                }
                catch (IllegalAccessException e) {
                   // handle exception
                }
        
        initComponents();
        printerID.setText(printer.getId() + "");
        printerIpAddress.setText(printer.getIp_address_printer());
        printerNamePrinter.setText(printer.getNama_printer());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        panelInput = new javax.swing.JPanel();
        labelID = new javax.swing.JLabel();
        labelIpAddress = new javax.swing.JLabel();
        labelNamePrinting = new javax.swing.JLabel();
        buttonSave = new javax.swing.JButton();
        printerID = new javax.swing.JLabel();
        printerIpAddress = new javax.swing.JLabel();
        printerNamePrinter = new javax.swing.JLabel();

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Printer Detail");
        setIconImage(null);
        setModal(true);
        setName("detailUser"); // NOI18N

        panelInput.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        labelID.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelID.setText("ID :");

        labelIpAddress.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelIpAddress.setText("IP Address :");

        labelNamePrinting.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelNamePrinting.setText("Name Printer :");

        buttonSave.setFont(new java.awt.Font("Tahoma", 1, 11));
        buttonSave.setText("OK");
        buttonSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSaveActionPerformed(evt);
            }
        });

        printerID.setText("printerID");

        printerIpAddress.setText("printerIpAddress");

        printerNamePrinter.setText("printerNamePrinter");

        javax.swing.GroupLayout panelInputLayout = new javax.swing.GroupLayout(panelInput);
        panelInput.setLayout(panelInputLayout);
        panelInputLayout.setHorizontalGroup(
            panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInputLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelID)
                    .addComponent(labelNamePrinting)
                    .addComponent(labelIpAddress))
                .addGap(39, 39, 39)
                .addGroup(panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(buttonSave)
                    .addComponent(printerNamePrinter)
                    .addComponent(printerID)
                    .addComponent(printerIpAddress))
                .addContainerGap(115, Short.MAX_VALUE))
        );
        panelInputLayout.setVerticalGroup(
            panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInputLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelID)
                    .addComponent(printerID))
                .addGap(7, 7, 7)
                .addGroup(panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIpAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(printerIpAddress))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNamePrinting)
                    .addComponent(printerNamePrinter))
                .addGap(18, 18, 18)
                .addComponent(buttonSave)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelInput, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
    this.setVisible(false);
}//GEN-LAST:event_buttonSaveActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
                
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    DialogDetailPrinter dialog = new DialogDetailPrinter(new javax.swing.JFrame(), true, new PrinterController().getPrinterManagement().getPrinter(3));
                    dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                        @Override
                        public void windowClosing(java.awt.event.WindowEvent e) {
                            System.exit(0);
                        }
                    });
                    dialog.setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(DialogDetailPrinter.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonSave;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel labelID;
    private javax.swing.JLabel labelIpAddress;
    private javax.swing.JLabel labelNamePrinting;
    private javax.swing.JPanel panelInput;
    private javax.swing.JLabel printerID;
    private javax.swing.JLabel printerIpAddress;
    private javax.swing.JLabel printerNamePrinter;
    // End of variables declaration//GEN-END:variables
}
